#ifndef __TaskQueue_H__
#define __TaskQueue_H__

#include "MutexLock.hpp"
#include "Condition.hpp"
#include "Task.hpp"

#include <queue>
using std::queue;

namespace wd
{

using ElemType = wd::Task;

class TaskQueue
{
public:
    TaskQueue(int sz);

    bool empty() const;
    bool full() const;
    void push(ElemType );
    ElemType pop();

    void wakeup();

private:
    queue<ElemType> _que;
    int _queSize;//表示当前队列中最多存放的元素个数
    MutexLock _mutex;
    Condition _notFull;
    Condition _notEmpty;
    bool _flag;
};

}//end of namespace wd


#endif

